package com.mingtai.design.pattern.structuralming.decorator;

/**
 * @description:
 * @author: mingtai
 * @createDate: 23:59 2021/1/5
 * @version: 1.0
 */

public class Test {
    public static void main(String[] args) {
        ABattercake aBattercake;
        // 父类引用指向子类对象
        aBattercake = new Battercake();
        // 鸡蛋装饰器开始装饰煎饼
        aBattercake = new EggDecorator(aBattercake);
        aBattercake = new EggDecorator(aBattercake);

        // 香肠装饰器开始装饰煎饼
        aBattercake = new SausageDecorator(aBattercake);

        // 装饰后的煎饼
        System.out.println(aBattercake.getDesc()+" 销售价格 "+aBattercake.cost());
    }
}



